package com.bananascrum.pages;

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;


public class LoginPage extends Page {

	private String correctLogin = "admin";
	private String correctPassword = "password";

	public LoginPage(WebDriver driver) {
		super(driver);
	}

	public static SprintPage login(String login, String password) {
		LoginPage loginPage = new LoginPage(driver);
		loginPage.open();
		insertText(By.id("login"), login);
		insertText(By.id("password"), password);
		loginPage.click(By.name("commit"));
		return new SprintPage(driver);
	}
	
	public SprintPage correctLogin(){
		return login(correctLogin , correctPassword );
	}
	
	public PasswordRecoveryPage goToPasswordRecovery(){
		LoginPage loginPage = new LoginPage(driver);
		loginPage.click(By.id("forgot-password"));
		return new PasswordRecoveryPage(driver);
	}
}
